home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Magazine 28 Bonus / CDRomMagazine-SoftKey-ArtPassion-FrenchVersion-Win31Mac.bin / data / shared.dir / 03028_Script_Back List < prev    next >
Text File  |  1996-06-21  |  3KB  |  92 lines

  1. -- --------------------------------------------------------
  2. -- Handler addSectionToBackList adds the given sectionName to
  3. -- a list of visited sections to be used by the back button.
  4.  
  5. on addSectionToBackList sectionName
  6.   global backList, backFlag
  7.   
  8.   -- note: the first time this is called, it will be sent a void
  9.   -- parameter. only add nonVoid values.
  10.   
  11.   --  note:  only add the sectionName to the list if the back
  12.   -- button was not clicked (to prevent going back and forth
  13.   -- between two sections by clicking numerous times on the
  14.   -- back button)
  15.   
  16.   if not(voidP(sectionName)) and not(backFlag) then
  17.     add(backList, sectionName)
  18.   end if
  19. end
  20.  
  21. -- --------------------------------------------------------
  22. -- Handler goBack goes to the last section visited.
  23.  
  24. on goBack
  25.   global backList
  26.   set numSections = count(backList)
  27.   if numSections then -- ie. if the list contains anything
  28.     set lastSection = getAt(backList,numSections)
  29.     deleteAt(backList,numSections) -- remove from list
  30.     setBackFlag(TRUE)
  31.     goSection(lastSection)
  32.   end if
  33. end
  34.  
  35. -- --------------------------------------------------------
  36. -- Handler checkBackButtonClick checks if the user clicked
  37. -- the back button and, if so, calls goBack.
  38.  
  39. on checkBackButtonClick mousePoint
  40.   global backButtonRect
  41.   
  42.   if inside(mousePoint,backButtonRect) then
  43.     doClickBackButton
  44.   end if
  45. end
  46.  
  47. -- --------------------------------------------------------
  48. -- Handler clickMenuBar checks if the user clicked
  49.  
  50. on clickMenuBar mousePoint
  51.   checkBackButtonClick mousePoint
  52. end
  53.  
  54. -- --------------------------------------------------------
  55. -- Handler setBackFlag sets the global variable backFlag to
  56. -- the given value. This is used in maintaining the global
  57. -- variable backList.
  58.  
  59. on setBackFlag val
  60.   global backFlag
  61.   
  62.   set backFlag = val
  63. end
  64.  
  65. -- --------------------------------------------------------
  66. -- Handler doClickBackButton 
  67.  
  68. on doClickBackButton
  69.   hiliteBackButtonClick
  70.   goBack
  71.   removefromStage (labelSprite)
  72. end
  73.  
  74. -- --------------------------------------------------------
  75. -- Handler hiliteBackButton 
  76.  
  77. on hiliteBackButtonClick
  78.   global labelSprite, backAH, backAV
  79.   
  80.   puppetSprite labelSprite, TRUE
  81.   set the castNum of sprite labelSprite = the number of cast "BackButton ACTIVATED"
  82.   
  83.   set the locH of sprite labelSprite = backAH
  84.   set the locV of sprite labelSprite = backAV
  85.   set the height of sprite labelSprite = the height of cast "BackButton ACTIVATED"
  86.   set the width of sprite labelSprite = the width of cast "BackButton ACTIVATED"
  87.   updateStage
  88.   repeat while the mouseDown
  89.     nothing
  90.   end repeat
  91.   
  92. end